<template>
<onekit-page>
<onekit-view onekit-class="container">
	<div is="onekit-template-head" :DATA="`${JSON.stringify({title:'Login'})}`"></div>
	<onekit-view onekit-class="page-body">
		<onekit-view onekit-class="page-section">
			<template v-if="hasLogin == true">
				<onekit-text onekit-class="page-body-title">已登录</onekit-text>
				<onekit-text onekit-class="page-body-text">每个微信号中仅需登录 1 次，后续每次进入页面即可根据微信 id 自动拉取用户信息</onekit-text>
			</template>
			<template v-if="hasLogin == false">
				<onekit-text onekit-class="page-body-text">每个微信号中仅需登录一次</onekit-text>
				<onekit-button onekit-class="page-body-button" type="primary" @Tap="login">微信登录</onekit-button>
			</template>
		</onekit-view>
	</onekit-view>
	<div is="onekit-template-foot"></div>
</onekit-view>
</onekit-page></template>
<script>
/* eslint-disable */
import Vue from 'vue';
import onekit_template_0 from '../../../common/head.head.vue';Vue.component('onekit-template-head',onekit_template_0);
import onekit_template_1 from '../../../common/foot.foot.vue';Vue.component('onekit-template-foot',onekit_template_1);
const ONEKIT_JSON= {
  "navigationBarTitleText": "微信登录",
  "usingComponents": {
    
  }
};
const ONEKIT_SJS = {
};
import wx from '../../../../weixin2vue/wx.js';
import Macro from '../../../../weixin2vue/Macro.js';
const {getApp,getCurrentPages} = Macro;
import Page from '../../../../weixin2vue/OnekitPage.js';
import Component from '../../../../weixin2vue/OnekitComponent.js';
const app = getApp();
export default Page(ONEKIT_JSON,["hasLogin"],ONEKIT_SJS,{
    "onShareAppMessage"(){
      return {
        "title":'微信登录',
        "path":'package/API/pages/login/login'
};
    },
    "onLoad"(){
      this.setData({
        "hasLogin":app.globalData.hasLogin
});
    },
    "data":{
},
    "login"(){
      const that = this;
      wx.login({
        "success"(){
          app.globalData.hasLogin = true;
          that.setData({
            "hasLogin":true
});
        }
});
    }
});

</script>
<style 
 lang="css">
.page-section {
  margin-top: 100px ;
  display: flex ;
  flex-direction: column ;
  align-items: center ;
  justify-content: center ;
  width: 100% ;
  padding: 0 25px ;
  box-sizing: border-box ;
}
.page-body-title {
  font-size: 30px ;
  line-height: 100px ;
}
.page-body-text {
  color: #bbb ;
  font-size: 14px ;
  line-height: 20px ;
  margin: 0 0 50px 0 ;
  text-align: center ;
}
.page-body-button {
  width: 100% ;
}
</style>